package com.itheima.homework.homework07;

//父类: 员工类
public class Worker {
    //属性：姓名 工号 工资
    private String name;
    private String id;
    private double salary;

    public Worker() {
    }

    public Worker(String name, String id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    //行为：工作work
    public void work(){ System.out.println("员工要工作.."); }
}

//子类: 项目经理类
class Manager extends Worker{
    //奖金
    private double bonus;

    public Manager(String name, String id, double salary, double bonus) {
        super(name, id, salary);
        this.bonus = bonus;
    }
    public Manager() {
    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }

    @Override
    public void work() {
        System.out.println("姓名为:"+super.getName()+",工号为:"+getId()+",工资为:"+this.getSalary()+",奖金为:"+bonus+",的项目经理正在管理程序员写代码");
    }
}

//子类: 程序员类
class Coder extends Worker{
    public Coder() {
    }

    public Coder(String name, String id, double salary) {
        super(name, id, salary);
    }

    @Override
    public void work() {
        System.out.println("姓名为:"+super.getName()+",工号为:"+super.getId()+",工资为:"+super.getSalary()+",的程序员正在编写代码");
    }
}
